﻿using Gonte.Data.Metadata;

using System.Text;

namespace Gonte.Desktop
{
    public class Application
    {
        #region Properties

        /// <summary>
        /// The name of the application
        /// </summary>
        public string Name { get; set; }

        /// <summary>
        /// The fully qualified unique name of the application
        /// </summary>
        public string FullName { get; set; }

        /// <summary>
        /// The application metadata
        /// </summary>
        public Domain Domain { get; set; }

        /// <summary>
        /// The database connection info for the application
        /// </summary>
        //public DatabaseConnection ConnectionInfo { get; set; }

        /// <summary>
        /// Directory where the DLLs are
        /// </summary>
        public string ExecutablePath { get; set; }

        /// <summary>
        /// The entities of the application
        /// </summary>
        //public IList<EntityInfo> Entities { get; set; }

        /// <summary>
        /// The configuration for the application
        /// </summary>
        public ApplicationConfig Config { get; set; }

        #endregion

        #region Methods

        /// <summary>
        /// Loads the application from the store
        /// </summary>
        /// <param name="appName"></param>
        /// <returns></returns>
        public static Application Load(string appName)
        {
            Application app = new Application
            {
                Name = appName,
                FullName = appName,
                //ConnectionInfo = new DatabaseConnection
                //{
                //    ConnectionString = string.Format("Connection String: {0}", appId),
                //},
                //ExecutablePath = string.Format("Path: {0}", appId),
                Config = new ApplicationConfig
                {
                    IconWidth = 60,
                    IconHeight = 60,
                    XSpacing = 50,
                    YSpacing = 50,
                    HighlightClass = "highlight"
                }
            };

            return app;
        }

        #endregion
    }
}
